package thread;

import javax.crypto.spec.PSource;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread t1 = new Thread(){
            @Override
            public void run() {
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    System.out.println("被中断");
                }
                System.out.println("被中断了，继续执行run方法");
            }
        };
        Thread t2 = new Thread(){
            @Override
            public void run() {
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("t2结束阻塞，中断t1");
                t1.interrupt();
            }
        };
        t1.start();
        t2.start();
    }
}
